 package service;

import java.util.List;

import cjgl.dao.TeacherDAO;
import cjgl.entity.Course;
import cjgl.entity.Student;
import cjgl.entity.Teacher;

public class TeacherService {
     private TeacherDAO teacherDAO = new TeacherDAO();

	public Teacher findById(Integer id) {
		return teacherDAO.findById(id);
	}

	public List<Teacher> findAll() {
		return teacherDAO.findAll();
	}


	public void delete(Integer id) {
		teacherDAO.delete(id);
	}

	public void sava(Teacher teacher) {
		Integer id=teacher.getId();
		if(id==null) {
			teacherDAO.insert(teacher);
		}else {
			teacherDAO.update(teacher);
		}
	}
	 public void delete(Teacher teacher) {
	    	teacherDAO.delete(teacher.getId());
	    	
	    
		}

	public Teacher findByUsernameAndPassword(String username, String password) {
		return teacherDAO.findByUsernameAndPassword(username, password);
	}

	public List<Teacher> findByTeacher(Integer id) {
		return teacherDAO.findByTeacher(id);
	}

	public Teacher login1(String username, String pwd) {
		return teacherDAO.login1(username,pwd);
	}
}
